package com.kawa.kemanage.service.impl;

import com.kawa.kemanage.entity.UserSetting;
import com.kawa.kemanage.mapper.UserSettingMapper;
import com.kawa.kemanage.service.UserSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserSettingServiceImpl implements UserSettingService {

    @Autowired
    private UserSettingMapper userSettingMapper;

    /**
     * 查询动画是否存在
     *
     * @param userId 用户id
     * @return
     */
    @Override
    public boolean queryAnimation(int userId) {
        return userSettingMapper.queryAnimation(userId) > 0;
    }


    /**
     * 查询动画列表
     *
     * @param userId 用户Id
     * @return
     */
    @Override
    public List<UserSetting> queryAnimationList(int userId) {
        return userSettingMapper.queryAnimationList(userId);
    }

    /**
     * 开启或关闭动画
     *
     * @param userId 用户Id
     * @param enable 是否关闭
     * @param animationId 动画Id
     * @return
     */
    @Override
    public boolean setAnimation(int userId, int enable, int animationId) {
        return userSettingMapper.setAnimation(userId,enable,animationId) > 0;
    }
}
